<html>
  <head>
    <meta name="source" content="http://www.terrainformatica.com/wiki/doku.php?id=h-smile:built-in-behaviors:edit"/>
    <meta name="generator" content="h-smile:richtext"/>
  </head>
<body>
  <h1>behavior: plaintext</h1>
  <p>Multiline editting behavior that is optimized to handle relatively large (thousands of lines) texts. </p>
  <h2>Elements</h2>
  <p>that have this behavior applied by default:</p>
  <ul>
    <li><code>&lt;plaintext&gt;...&lt;/plaintext&gt;</code> display:block editor;</li></ul>
  <h2>Attributes</h2>
  <p>that this behavior knows about:</p>
  <ul>
    <li><code>readonly</code> - &nbsp;declares that element is read only.</li></ul>
  <h2>Model</h2>
  <p>Plaintext parses each line of text into separate &lt;text&gt; element: </p>
  <pre>&lt;plaintext&gt;
   &lt;text&gt;Line 1&lt;/text&gt;
   &lt;text&gt;Line 2&lt;/text&gt;
   &lt;text&gt;Line 3&lt;/text&gt;
&lt;/plaintext&gt;
</pre>
  <h2>Events</h2>
  <p>Together with the standard set of events (mouse, keyboard, focus) <em>behavior: button</em> generates:</p>
  <ul>
    <li>EDIT_VALUE_CHANGED event - value of the element was changed due to user actions. Posted (asynchronous) event.</li>
    <li>EDIT_VALUE_CHANGING event - sent when value of the element is about to change. Synchronous event.</li></ul>
  <h2>Value</h2>
  <p>string, reflects current status of internal editing buffer.</p>
  <h2>Special key combinations</h2>
  <ul>
    <li>LEFT, CTRL+LEFT, SHIFT+LEFT, CTRL+SHIFT+LEFT</li>
    <li>RIGHT, CTRL+RIGHT, SHIFT+RIGHT, CTRL+SHIFT+RIGHT</li>
    <li>HOME, SHIFT+HOME</li>
    <li>END, SHIFT+END</li>
    <li>BACKSPACE, ALT+BACKSPACE, CTRL+BACKSPACE</li>
    <li>CTRL+A</li>
    <li>DELETE, SHIFT+DELETE, CTRL+DELETE</li>
    <li>INSERT, SHIFT+INSERT, CTRL+INSERT</li>
    <li>CTRL+X</li>
    <li>CTRL+V</li>
    <li>CTRL+Z</li>
    <li>CTRL+(LEFT)SHIFT and CTRL+(RIGHT)SHIFT - in forms having the <code>dir</code> attribute these key combinations switches between <code>dir=&quot;ltr&quot;</code> and <code>dir=&quot;rtl&quot;</code>.</li></ul><h2>Commands</h2><p>Commands supported by the behavior through <code>Element.execCommand()</code> and <code>Element.queryMethods()</code>:&nbsp;</p><ul><li><code>&quot;edit:cut&quot;</code> - cut selection - copy selection to the clipboard and remove it;</li><li><code>&quot;edit:copy&quot;</code> - copy selection to the clipboard;</li><li><code>&quot;edit:paste&quot;</code> - paste content of the clipboard;</li><li><code>&quot;edit:selectall&quot;</code> - select whole content of the element;</li><li><code>&quot;edit:undo&quot;</code> - undo last editing operation;</li><li><code>&quot;edit:redo&quot;</code> - redo last operation that was undone;</li><li><code>&quot;edit:delete-next&quot;</code> - if there is a selection - delete selected content, otherwise delete next character;</li><li><code>&quot;edit:delete-prev&quot;</code> - if there is a selection - delete selected content, otherwise delete previous character;</li><li><code>&quot;edit:delete-word-next&quot;</code> - if there is a selection - delete selected content, otherwise delete next word;</li><li><code>&quot;edit:delete-word-prev&quot;</code> - if there is a selection - delete selected content, otherwise delete previous word;</li></ul>
        
        
        
        
        
        
        
        
        
  <h2>Methods</h2>
  <dl>
    <dt><code>loadDocument</code></dt>
    <dd><code>(url:string): true|false</code> 
        <p>loads file from URL into the editor;</p></dd>
    <dt><code>saveDocument</code></dt>
    <dd><code>(url:string): true|false</code> 
        <p>saves content to file;</p></dd>
    <dt><code>setContent</code></dt>
    <dd><code>(text:string):&nbsp;true|false</code>
        <p>sets content from the string;</p></dd>
    <dt><code>setContent</code></dt>
    <dd><code>(text:string, selStart:integer, selEnd:integer):&nbsp;true|false</code>
        <p>sets content from the <i>text</i> and selection from&nbsp;given <i>selStart</i> and <i>selEnd</i>;</p></dd><dt><code>getContent</code></dt><dd><code>() : [string, integer, integer] </code><p>returns content and selection as an array of three elements;</p>
        </dd>
    </dl>
</body>
</html>